#ifndef __VIM_H__
#define __VIM_H__

#include "config.h"
#include "vbuf.h"

#define VGDB_VMSG_BLEN   64
#define VGDB_VMSG_BNR    16

#define VGDB_VS_QUIT        0
#define VGDB_VS_WAIT        1
#define VGDB_VS_DETACHED    2
#define VGDB_VS_ATTACHED    3
#define VGDB_VS_STOP        4
#define VGDB_VS_RUN         5


typedef struct{
    pid_t       pid;
    int         state;
    int         datsock;
    char        msgb[VGDB_VMSG_BLEN*VGDB_VMSG_BNR];
    int         blen;
    int         bnr;
    int         bcur;

    char        curfn[VGDB_FN_LEN];
    int         curln;
    int         curofs;

    int         seqno;

    vbuf_t      srcbuf;
    vbuf_t      optbuf;
    vbuf_t      varbuf;

    int         version;
}vim_t;

extern vim_t    g_vim_instance;


extern int  vim_connect();
extern void vim_init();

#define vim()   (&g_vim_instance)

#endif
